<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - autotest.info - AgileUT/product/product1.c</title>
  <link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../index.html">top level</a> - <a href="index.html">AgileUT/product</a> - product1.c<span style="font-size: 80%;"> (source / <a href="product1.c.func.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">autotest.info</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">5</td>
            <td class="headerCovTableEntry">26</td>
            <td class="headerCovTableEntryLo">19.2 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2012-07-06</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">1</td>
            <td class="headerCovTableEntry">5</td>
            <td class="headerCovTableEntryLo">20.0 %</td>
          </tr>
          <tr>
            <td></td>
            <td></td>
            <td></td>
            <td class="headerItem">Branches:</td>
            <td class="headerCovTableEntry">2</td>
            <td class="headerCovTableEntry">6</td>
            <td class="headerCovTableEntryLo">33.3 %</td>
          </tr>
          <tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">           Branch data     Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>                :            : /* Wang Wen(Albert Wang) jawangwen@gmail.com */</a>
<span class="lineNum">       2 </span>                :            : 
<span class="lineNum">       3 </span>                :            : #include &lt;stdio.h&gt;
<span class="lineNum">       4 </span>                :            : #include &lt;assert.h&gt;
<span class="lineNum">       5 </span>                :            : #include &lt;product.h&gt;
<span class="lineNum">       6 </span>                :            : #include &lt;product1.h&gt;
<span class="lineNum">       7 </span>                :            : 
<span class="lineNum">       8 </span>                :            : #define RISK_FACTOR_SEED 0x8086
<span class="lineNum">       9 </span>                :            : #define RISK_FACTOR_MAX  10
<span class="lineNum">      10 </span>                :            : #define RISK_LEVEL_MAX   3
<span class="lineNum">      11 </span>                :            : 
<span class="lineNum">      12 </span>                :            : static const char * riskInfo[RISK_LEVEL_MAX] = {
<span class="lineNum">      13 </span>                :            :     &quot;No risk&quot;,
<span class="lineNum">      14 </span>                :            :     &quot;Low risk&quot;,
<span class="lineNum">      15 </span>                :            :     &quot;High risk&quot;,
<span class="lineNum">      16 </span>                :            : };
<span class="lineNum">      17 </span>                :            : 
<span class="lineNum">      18 </span>                :            : static int riskFactor[RISK_FACTOR_MAX];
<a name="19"><span class="lineNum">      19 </span>                :            : </a>
<span class="lineNum">      20 </span>                :            : static void sendMessage (const char * str)
<span class="lineNum">      21 </span>                :<span class="lineNoCov">          0 : {</span>
<span class="lineNum">      22 </span>                :<span class="lineNoCov">          0 :     printf(&quot;%s\n&quot;, str);</span>
<span class="lineNum">      23 </span>                :            : }
<a name="24"><span class="lineNum">      24 </span>                :            : </a>
<span class="lineNum">      25 </span>                :            : int addRisk (unsigned int riskValue)
<span class="lineNum">      26 </span>                :<span class="lineNoCov">          0 : {</span>
<span class="lineNum">      27 </span>                :<span class="lineNoCov">          0 :     int indexRiskFactor;</span>
<span class="lineNum">      28 </span>                :<span class="lineNoCov">          0 :     indexRiskFactor = riskValue % RISK_FACTOR_MAX;</span>
<span class="lineNum">      29 </span>                :<span class="lineNoCov">          0 :     riskFactor[indexRiskFactor]++;</span>
<span class="lineNum">      30 </span>                :<span class="lineNoCov">          0 :     return 0;</span>
<span class="lineNum">      31 </span>                :            : }
<a name="32"><span class="lineNum">      32 </span>                :            : </a>
<span class="lineNum">      33 </span>                :            : int subRisk (unsigned int riskValue)
<span class="lineNum">      34 </span>                :<span class="lineNoCov">          0 : {</span>
<span class="lineNum">      35 </span>                :<span class="lineNoCov">          0 :     int indexRiskFactor;</span>
<span class="lineNum">      36 </span>                :<span class="lineNoCov">          0 :     indexRiskFactor = riskValue % RISK_FACTOR_MAX;</span>
<span class="lineNum">      37 </span>                :<span class="lineNoCov">          0 :     riskFactor[indexRiskFactor]--;</span>
<span class="lineNum">      38 </span>                :<span class="lineNoCov">          0 :     return 0;</span>
<span class="lineNum">      39 </span>                :            : }
<a name="40"><span class="lineNum">      40 </span>                :            : </a>
<span class="lineNum">      41 </span>                :            : static int getRiskLevel (void)
<span class="lineNum">      42 </span>                :<span class="lineNoCov">          0 : {</span>
<span class="lineNum">      43 </span>                :<span class="lineNoCov">          0 :     int indexRiskFactor;</span>
<span class="lineNum">      44 </span>                :<span class="lineNoCov">          0 :     int riskLevel;</span>
<span class="lineNum">      45 </span>                :            : 
<span class="lineNum">      46 </span>                :<span class="lineNoCov">          0 :     riskLevel = RISK_FACTOR_SEED;</span>
<span class="lineNum">      47 </span>        [<span class="branchNoExec" title="Branch 0 was not executed"> # </span><span class="branchNoExec" title="Branch 1 was not executed"> # </span>]:<span class="lineNoCov">          0 :     for (indexRiskFactor = 0; indexRiskFactor &lt; RISK_FACTOR_MAX; ++indexRiskFactor) {</span>
<span class="lineNum">      48 </span>                :<span class="lineNoCov">          0 :         riskLevel &gt;&gt;= 1;</span>
<span class="lineNum">      49 </span>                :<span class="lineNoCov">          0 :         riskLevel  ^= riskFactor[indexRiskFactor];</span>
<span class="lineNum">      50 </span>                :            :     }
<span class="lineNum">      51 </span>                :<span class="lineNoCov">          0 :     riskLevel &amp;= RISK_LEVEL_MAX;</span>
<span class="lineNum">      52 </span>                :            : 
<span class="lineNum">      53 </span>                :<span class="lineNoCov">          0 :     return riskLevel;</span>
<span class="lineNum">      54 </span>                :            : }
<a name="55"><span class="lineNum">      55 </span>                :            : </a>
<span class="lineNum">      56 </span>                :            : void showRisk (void)
<span class="lineNum">      57 </span>                :<span class="lineCov">          1 : {</span>
<span class="lineNum">      58 </span>                :<span class="lineCov">          1 :     int riskLevel;</span>
<span class="lineNum">      59 </span>                :            : 
<span class="lineNum">      60 </span>                :<span class="lineCov">          1 :     riskLevel = getRiskLevel();</span>
<span class="lineNum">      61 </span>[<span class="branchCov" title="Branch 0 was taken 1 time"> + </span><span class="branchNoCov" title="Branch 1 was not taken"> - </span>][<span class="branchCov" title="Branch 2 was taken 1 time"> + </span><span class="branchNoCov" title="Branch 3 was not taken"> - </span>]:<span class="lineCov">          1 :     assert(riskLevel &gt;=0 &amp;&amp; riskLevel &lt; RISK_LEVEL_MAX);</span>
<span class="lineNum">      62 </span>                :            : 
<span class="lineNum">      63 </span>                :<span class="lineCov">          1 :     sendMessage(riskInfo[riskLevel]);</span>
<span class="lineNum">      64 </span>                :            : }
<span class="lineNum">      65 </span>                :            : 
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.9</a></td></tr>
  </table>
  <br>

</body>
</html>
